from DecisionTree import DecisionTree
import sys

def main() :
    d = DecisionTree()
    d.ReadFromFile("car.data")
    d.learn()
    #print to file
    a = sys.stdout
    sys.stdout = open("tree.txt", 'w')
    d.tree.display()
    sys.stdout = a
    #print to console
    d.tree.display()

main()